<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>for of 与 for in</title>
</head>
<body>
    
</body>
<script>
    let arr = [{name:'a', age:16 },{ name:'b', age:17 },{ name:'c', age:18 }]

    for (let item of arr) {
        console.log(item);  //for of 返回的 元素
    }
    for (let index in arr) {
        console.log(index); //for in 返回的是 index
    }

    
    let obj = { a:1, b:2, c:3 }
    for (let key in obj) {
        console.log(key); //for in 返回的是 key
    }
    //for of 不能作用在对象

</script>
</html>